#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Datetime: 2022/9/26 11:37
# @Author  : CHENWang
# @Site    : 
# @File    : weekly_get_cex_spot_volume_maxdrawdown.py
# @Software: PyCharm

"""
脚本说明:
"""

from TQR_Applications.factor_database.crypto.trading_data_update import get_cex_spot_volume_maxdrawdown
from logger import logger
import os
import traceback
from task_monitor import task_to_db, send_error_to_email


if __name__ == '__main__':
    # 交易所现货交易额回撤，其中利用了weekly_get_cex_analysis_data的数据，因此需要等weekly_get_cex_analysis_data执行完再执行，时间设定为周六下午7点
    logger.info("开始get_cex_spot_volume_maxdrawdown")
    task_to_db(os.path.basename(__file__), 'get_cex_spot_volume_maxdrawdown')
    try:
        get_cex_spot_volume_maxdrawdown()
    except Exception as e:
        msg = traceback.format_exc()
        logger.info(msg)
        send_error_to_email(script_name=os.path.basename(__file__), func_name="get_cex_spot_volume_maxdrawdown", message=msg)
        raise e
    task_to_db(os.path.basename(__file__), 'get_cex_spot_volume_maxdrawdown', 1)
    logger.info("成功get_cex_spot_volume_maxdrawdown")